home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / structfind.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.4 KB  |  36 lines

  1. <!--- This view-only example illustrates usage
  2.       of StructFind. --->
  3. <P>This file is identical to addemployee.cfm, which is called
  4. by StructNew, StructClear, and StructDelete. It is an 
  5. example of a custom tag used to add employees. Employee 
  6. information is passed through the employee structure (the 
  7. EMPINFO attribute). 
  8. <P>
  9. To run this snippet
  10. under UNIX, you must add employee ID generation logic.
  11. <!--- 
  12. <cfswitch expression="#ThisTag.ExecutionMode#">
  13.    <cfcase value="start">
  14.       <CFIF StructIsEmpty(attributes.EMPINFO)>
  15.         <CFOUTPUT>Error. No employee data was passed.</cfoutput>
  16.           <CFEXIT METHOD="ExitTag">
  17.         <cfelse>
  18.            <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
  19.             INSERT INTO Employees(FirstName, LastName, Email, Phone, Department)
  20.               VALUES 
  21.                 <CFOUTPUT>
  22.                   (
  23.                     '#StructFind(attributes.EMPINFO, "firstname")#' ,
  24.                     '#StructFind(attributes.EMPINFO, "lastname")#' ,
  25.                     '#StructFind(attributes.EMPINFO, "email")#' ,
  26.                     '#StructFind(attributes.EMPINFO, "phone")#' ,
  27.                     '#StructFind(attributes.EMPINFO, "department")#'
  28.                    )
  29.                 </cfoutput> 
  30.           </cfquery>
  31.         </cfif>
  32.       <CFOUTPUT><HR>Employee Add Complete</cfoutput>
  33.    </cfcase>
  34. </cfswitch> --->
  35.  
  36.